﻿using System;
using System . Collections . Generic;
using System . Collections . ObjectModel;
using System . Linq;
using System . Text;
using System . Xml . Linq;

namespace GameClassLibrary . Maps
{
    public class Map : GameObject
    {
        public List<Area> Areas { get; set; }

        public List<Road> Roads { get; set; }

        public List<Decoration> Decorations { get; set; }

        public Map ( XElement saving ) : base ( saving )
        {

        }

        public Map ( ) : base ( )
        {
            //todo
        }

        public Map ( string flieName ) : this ( )
        {
            XDocument doc= ResourceHelper . GetXmlDocument ( @"MapsResource." + flieName );

            //doc.Root
        }

        public override void NextDay ( )
        {
            throw new NotImplementedException ( );
        }

        public override XElement Save ( )
        {
            XElement temp=base.Save();

            XElement areas=new XElement("Areas");
            XElement roads=new XElement("Roads");
            XElement decorations=new XElement("Decorations");

            foreach ( var item in Areas )
            {
                areas . Add ( item . Save ( ) );
            }
            foreach ( var item in Roads )
            {
                roads . Add ( item . Save ( ) );
            }
            foreach ( var item in Decorations )
            {
                decorations . Add ( item . Save ( ) );
            }

            temp . Add ( areas , roads , decorations );

            return temp;
        }
    }

}